{
  "properties" : { },
  "id" : "8f2bece5331b480f88ea95df2061576b",
  "script" : null,
  "groupId" : "fab72dbfa20d4363af209197603c2b6e",
  "name" : "初始页面",
  "createTime" : 1727070981306,
  "updateTime" : 1724749683131,
  "lock" : "1",
  "createBy" : "ndmp",
  "updateBy" : "ndmp",
  "path" : "list",
  "method" : "GET",
  "parameters" : [ {
    "name" : "current",
    "value" : "1",
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "1",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  }, {
    "name" : "size",
    "value" : "5",
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "30",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  }, {
    "name" : "metircName",
    "value" : "",
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  }, {
    "name" : "levelName",
    "value" : "急",
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  } ],
  "options" : [ ],
  "requestBody" : "",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : "{\n    \"status\": 200,\n    \"message\": \"success\",\n    \"data\": {\n        \"total\": 5,\n        \"current\": 1,\n        \"size\": 5,\n        \"records\": [\n            {\n                \"metircName\": \"CPU使用率\",\n                \"code\": \"cpuUsage\",\n                \"levelName\": \"紧急\",\n                \"context\": \"\",\n                \"result\": \"CPU使用率 >50 %\",\n                \"rowId\": 1\n            },\n            {\n                \"metircName\": \"丢包率\",\n                \"code\": \"packetLoss\",\n                \"levelName\": \"紧急\",\n                \"context\": \"\",\n                \"result\": \"丢包率 >30 %\",\n                \"rowId\": 2\n            },\n            {\n                \"metircName\": \"内存利用率\",\n                \"code\": \"memUsage\",\n                \"levelName\": \"紧急\",\n                \"context\": \"\",\n                \"result\": \"内存利用率 >70 %\",\n                \"rowId\": 3\n            },\n            {\n                \"metircName\": \"时延\",\n                \"code\": \"delayTime\",\n                \"levelName\": \"紧急\",\n                \"context\": \"\",\n                \"result\": \"时延 >10 ms\",\n                \"rowId\": 4\n            },\n            {\n                \"metircName\": \"温度\",\n                \"code\": \"temperature\",\n                \"levelName\": \"紧急\",\n                \"context\": \"\",\n                \"result\": \"温度 >28 °C\",\n                \"rowId\": 5\n            }\n        ]\n    }\n}",
  "description" : "",
  "requestBodyDefinition" : {
    "name" : "",
    "value" : { },
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  },
  "responseBodyDefinition" : {
    "name" : "",
    "value" : "",
    "description" : "",
    "required" : false,
    "dataType" : "Object",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ {
      "name" : "code",
      "value" : "1",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : "",
      "defaultValue" : "",
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "message",
      "value" : "success",
      "description" : "",
      "required" : false,
      "dataType" : "String",
      "type" : "",
      "defaultValue" : "",
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "data",
      "value" : "",
      "description" : "",
      "required" : false,
      "dataType" : "Object",
      "type" : "",
      "defaultValue" : "",
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ {
        "name" : "total",
        "value" : "10",
        "description" : "",
        "required" : false,
        "dataType" : "Integer",
        "type" : "",
        "defaultValue" : "",
        "validateType" : "",
        "error" : "",
        "expression" : "",
        "children" : [ ]
      }, {
        "name" : "list",
        "value" : "",
        "description" : "",
        "required" : false,
        "dataType" : "Array",
        "type" : "",
        "defaultValue" : "",
        "validateType" : "",
        "error" : "",
        "expression" : "",
        "children" : [ {
          "name" : "",
          "value" : "",
          "description" : "",
          "required" : false,
          "dataType" : "Object",
          "type" : "",
          "defaultValue" : "",
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ {
            "name" : "metircName",
            "value" : "CPU使用率",
            "description" : "",
            "required" : false,
            "dataType" : "String",
            "type" : "",
            "defaultValue" : "",
            "validateType" : "",
            "error" : "",
            "expression" : "",
            "children" : [ ]
          }, {
            "name" : "levelName",
            "value" : "紧急",
            "description" : "",
            "required" : false,
            "dataType" : "String",
            "type" : "",
            "defaultValue" : "",
            "validateType" : "",
            "error" : "",
            "expression" : "",
            "children" : [ ]
          }, {
            "name" : "context",
            "value" : "",
            "description" : "",
            "required" : false,
            "dataType" : "String",
            "type" : "",
            "defaultValue" : "",
            "validateType" : "",
            "error" : "",
            "expression" : "",
            "children" : [ ]
          }, {
            "name" : "result",
            "value" : "CPU使用率 >50 %",
            "description" : "",
            "required" : false,
            "dataType" : "String",
            "type" : "",
            "defaultValue" : "",
            "validateType" : "",
            "error" : "",
            "expression" : "",
            "children" : [ ]
          }, {
            "name" : "rowId",
            "value" : "1",
            "description" : "",
            "required" : false,
            "dataType" : "Integer",
            "type" : "",
            "defaultValue" : "",
            "validateType" : "",
            "error" : "",
            "expression" : "",
            "children" : [ ]
          } ]
        } ]
      } ]
    }, {
      "name" : "timestamp",
      "value" : "1724722049832",
      "description" : "",
      "required" : false,
      "dataType" : "Long",
      "type" : "",
      "defaultValue" : "",
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "executeTime",
      "value" : "58",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : "",
      "defaultValue" : "",
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    } ]
  }
}
================================

var sql = """

SELECT met.metirc_name,met.code,leve.level_name,da.context,
       CASE
           WHEN met.metirc_category = 0 THEN CONCAT(met.metirc_name, ' ', rul.expression, ' ', rul.unit)
           WHEN met.metirc_category = 1 THEN rul.rule_name
       END AS result
FROM alarm_rule rul
         LEFT JOIN alarm_metric met ON met.id = rul.rule_metric_id
         LEFT JOIN alarm_level leve ON rul.level = leve.level
         LEFT JOIN ndmp_knowledge_data da ON da.title = rul.rule_name
         where 1 = 1
         <if test="metircName != null and metircName != ''">
            and met.metirc_name like concat('%',#{metircName},'%')
         </if>
         <if test="levelName != null and levelName != ''">
            and leve.level_name like concat('%',#{levelName},'%')
         </if>

"""

return db.page(sql) 